package com.iotechn.unimall.admin.api.server;


import com.dobbinsoft.fw.core.annotation.HttpMethod;
import com.dobbinsoft.fw.core.annotation.HttpOpenApi;
import com.dobbinsoft.fw.core.annotation.HttpParam;
import com.dobbinsoft.fw.core.annotation.HttpParamType;
import com.dobbinsoft.fw.core.annotation.param.NotNull;
import com.dobbinsoft.fw.core.exception.ServiceException;
import com.dobbinsoft.fw.support.model.Page;
import com.iotechn.unimall.data.domain.ServerDO;
import com.iotechn.unimall.data.vo.SelectVO;
import com.iotechn.unimall.data.vo.ServerVO;
import com.iotechn.unimall.data.vo.TreeVO;

import java.util.List;

@HttpOpenApi(group = "admin.server", description = "服务管理")
public interface ServerService{

    @HttpMethod(description = "列表", permission = "admin:server:page", permissionParentName = "服务管理", permissionName = "服务管理")
    public Page<ServerVO> page(
            @HttpParam(name = "page", type = HttpParamType.COMMON, description = "页码", valueDef = "1") Integer page,
            @HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度", valueDef = "20") Integer limit,
            @HttpParam(name = "name", type = HttpParamType.COMMON, description = "名称") String name,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;


    @HttpMethod(description = "添加", permission = "admin:server:create", permissionParentName = "服务管理", permissionName = "服务管理")
    public String create(
            @HttpParam(name = "serverDO", type = HttpParamType.COMMON, description = "服务json") ServerDO serverDO,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;


    @HttpMethod(description = "更新", permission = "admin:server:update", permissionParentName = "服务管理", permissionName = "服务管理")
    public String update(
            @HttpParam(name = "serverDO", type = HttpParamType.COMMON, description = "服务json") ServerDO serverDO,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "删除", permission = "admin:server:delete", permissionParentName = "服务管理", permissionName = "服务管理")
    public String delete(
            @HttpParam(name = "id", type = HttpParamType.COMMON, description = "服务id") Long id,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "查询服务", permission = "admin:server:query", permissionParentName = "服务管理", permissionName = "服务管理")
    public List<ServerDO> query(
            @HttpParam(name = "id", type = HttpParamType.COMMON, description = "服务id") Long id,
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId) throws ServiceException;

    @HttpMethod(description = "服务树级")
    public List<TreeVO> tree(
            @NotNull @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "管理员Id") Long adminId
    ) throws ServiceException;

}
